
#include"newSort.h"

void test_InsertSort()
{
	//int arr[] = { 4,3,9,1,2,7,8,5,2,1,4,5,6,3,2,5,55,0 };
	int arr[] = {20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	InsertSort(arr, size);
	PrintArray(arr, size);
}

void test_ShellSort()
{
	int arr[] = { 4,3,9,1,2,7,8,5,2,1,4,5,6,3,2,5,55,0 };
	//int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	ShellSort(arr, size);
	PrintArray(arr, size);
}

void test_BubbleSort()
{
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	BubbleSort(arr, size);
	PrintArray(arr, size);
}

void test_QuickSort()
{
	//int arr[] = { 4,3,9,1,2,7,8,5,2,1,4,5,6,3,2,5,55,0 };
	//int arr[] = { 4,3,9,1,2,5 };
	//int arr[] = { 1,2,3,4,5};
	//
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	QuickSort(arr, 0,size);
	PrintArray(arr, size);
}

void test_SelectSort()
{
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	SelectSort(arr, size);
	PrintArray(arr, size);
}

void test_HeapSort()
{
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	//int arr[] = { 4,3,9,1,2,5 ,8,0};
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	HeapSort(arr, size);
	PrintArray(arr, size);
}

void test_MergeSort()
{
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 ,5,2,4,7,6,3,2,5,4,1,9,5,4,554,92,-1};
	//int arr[] = { 4,3,9,1,2,5 ,8,0};
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	//MergeSort(arr,size);
	MergeSortUR(arr,size);
	PrintArray(arr, size);
}

void test_CountSort()
{
	int arr[] = { 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
	//int arr[] = { 4,3,9,1,2,5 ,8,0};
	int size = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, size);
	CountSort(arr, size);
	PrintArray(arr, size);
}
int main()
{
	//test_InsertSort();
	//test_ShellSort();
	test_BubbleSort();
	test_QuickSort();
	//test_SelectSort();
	//test_HeapSort();
	//test_MergeSort();
	//test_CountSort();

	/*Stack st;
	StackInit(&st);
	StackPush(&st, 8);
	StackPush(&st, 8);
	StackPush(&st, 1);
	StackPop(&st);
	StackPush(&st, 8);
	StackPush(&st, 8);
	StackPush(&st, 6);
	StackPush(&st, 8);
	for (int i = 0; i <= st.top; i++)
	{
		printf("%d ",st.arr[i]);
	}

	StackDestory(&st);*/
	return 0;
}